.class Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;
.super Ljava/lang/Thread;
.source "QAsyncHttpClient.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/mime/qweibo/QAsyncHttpClient;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "AsyncThread"
.end annotation


# instance fields
.field private mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

.field private mCookie:Ljava/lang/Object;

.field private mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

.field final synthetic this$0:Lcom/mime/qweibo/QAsyncHttpClient;


# direct methods
.method public constructor <init>(Lcom/mime/qweibo/QAsyncHttpClient;Lorg/apache/commons/httpclient/HttpMethod;Lcom/mime/qweibo/QAsyncHandler;Ljava/lang/Object;)V
    .locals 0
    .parameter
    .parameter "method"
    .parameter "handler"
    .parameter "cookie"

    .prologue
    .line 155
    iput-object p1, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->this$0:Lcom/mime/qweibo/QAsyncHttpClient;

    .line 150
    invoke-direct {p0}, Ljava/lang/Thread;-><init>()V

    .line 152
    iput-object p2, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    .line 153
    iput-object p3, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    .line 154
    iput-object p4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mCookie:Ljava/lang/Object;

    return-void
.end method


# virtual methods
.method public run()V
    .locals 7

    .prologue
    .line 159
    const/4 v2, 0x0

    .line 160
    .local v2, responseData:Ljava/lang/String;
    new-instance v1, Lorg/apache/commons/httpclient/HttpClient;

    invoke-direct {v1}, Lorg/apache/commons/httpclient/HttpClient;-><init>()V

    .line 161
    .local v1, httpClient:Lorg/apache/commons/httpclient/HttpClient;
    const/4 v3, -0x1

    .line 163
    .local v3, statusCode:I
    :try_start_0
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-virtual {v1, v4}, Lorg/apache/commons/httpclient/HttpClient;->executeMethod(Lorg/apache/commons/httpclient/HttpMethod;)I

    move-result v3

    .line 164
    const/16 v4, 0xc8

    if-eq v3, v4, :cond_0

    .line 165
    sget-object v4, Ljava/lang/System;->err:Ljava/io/PrintStream;

    new-instance v5, Ljava/lang/StringBuilder;

    const-string v6, "HttpMethod failed: "

    invoke-direct {v5, v6}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 166
    iget-object v6, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-interface {v6}, Lorg/apache/commons/httpclient/HttpMethod;->getStatusLine()Lorg/apache/commons/httpclient/StatusLine;

    move-result-object v6

    invoke-virtual {v5, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v5

    invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    .line 165
    invoke-virtual {v4, v5}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V

    .line 168
    :cond_0
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-interface {v4}, Lorg/apache/commons/httpclient/HttpMethod;->getResponseBodyAsString()Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Lorg/apache/commons/httpclient/HttpException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    move-result-object v2

    .line 182
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-interface {v4}, Lorg/apache/commons/httpclient/HttpMethod;->releaseConnection()V

    .line 183
    const/4 v1, 0x0

    .line 185
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    if-eqz v4, :cond_1

    .line 186
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    iget-object v5, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mCookie:Ljava/lang/Object;

    invoke-interface {v4, v3, v2, v5}, Lcom/mime/qweibo/QAsyncHandler;->onCompleted(ILjava/lang/String;Ljava/lang/Object;)V

    .line 188
    :cond_1
    :goto_0
    return-void

    .line 169
    :catch_0
    move-exception v0

    .line 170
    .local v0, e:Lorg/apache/commons/httpclient/HttpException;
    :try_start_1
    invoke-virtual {v0}, Lorg/apache/commons/httpclient/HttpException;->printStackTrace()V

    .line 171
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    if-eqz v4, :cond_2

    .line 172
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    iget-object v5, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mCookie:Ljava/lang/Object;

    invoke-interface {v4, v0, v5}, Lcom/mime/qweibo/QAsyncHandler;->onThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 182
    :cond_2
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-interface {v4}, Lorg/apache/commons/httpclient/HttpMethod;->releaseConnection()V

    .line 183
    const/4 v1, 0x0

    .line 174
    goto :goto_0

    .line 175
    .end local v0           #e:Lorg/apache/commons/httpclient/HttpException;
    :catch_1
    move-exception v0

    .line 176
    .local v0, e:Ljava/io/IOException;
    :try_start_2
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    .line 177
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    if-eqz v4, :cond_3

    .line 178
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mAsyncHandler:Lcom/mime/qweibo/QAsyncHandler;

    iget-object v5, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mCookie:Ljava/lang/Object;

    invoke-interface {v4, v0, v5}, Lcom/mime/qweibo/QAsyncHandler;->onThrowable(Ljava/lang/Throwable;Ljava/lang/Object;)V
    :try_end_2
    .catchall {:try_start_2 .. :try_end_2} :catchall_0

    .line 182
    :cond_3
    iget-object v4, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-interface {v4}, Lorg/apache/commons/httpclient/HttpMethod;->releaseConnection()V

    .line 183
    const/4 v1, 0x0

    .line 180
    goto :goto_0

    .line 181
    .end local v0           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v4

    .line 182
    iget-object v5, p0, Lcom/mime/qweibo/QAsyncHttpClient$AsyncThread;->mHttpMedthod:Lorg/apache/commons/httpclient/HttpMethod;

    invoke-interface {v5}, Lorg/apache/commons/httpclient/HttpMethod;->releaseConnection()V

    .line 183
    const/4 v1, 0x0

    .line 184
    throw v4
.end method
